package com.tegtech.starter.security.handler;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.stereotype.Component;

import com.tegtech.common.domain.Result;
import com.tegtech.common.enums.HttpStatus;
import com.tegtech.common.utils.http.ServletUtils;

/**
 * 无权访问
 * @Author Jun
 * @date 2020年5月30日 下午8:25:02
 */
@Component
public class SysAccessDeniedHandler implements AccessDeniedHandler {
	
    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e) throws IOException, ServletException {
    	ServletUtils.reponseData(response, Result.err(HttpStatus.FORBIDDEN));
    }
    
}